#include <slv2/slv2.h>

void die(char *s) {
	printf("%s",s);
	exit(1);
}

int main() {
	SLV2World world=slv2_world_new();
	slv2_world_load_all(world);
	SLV2Plugins plugins=slv2_world_get_all_plugins(world);
	SLV2Plugin plugin;
	SLV2Instance instance;

/*	int i;

	for (i=0; i<slv2_plugins_size(plugins); i++) {
		SLV2Plugin p=slv2_plugins_get_at(plugins, i);
		printf("%s\n",slv2_value_as_uri(slv2_plugin_get_uri(p)));
	}*/

	char *uri="http://calf.sourceforge.net/plugins/Reverb";
	SLV2Value plugin_uri = slv2_value_new_uri(world,uri);
	plugin = slv2_plugins_get_by_uri(plugins, plugin_uri);
	slv2_value_free(plugin_uri);	
	if (!plugin)
		die("unable to get plugin.\n");

	SLV2Value name = slv2_plugin_get_name(plugin);
	const char* name_str = slv2_value_as_string(name);
	printf("Plugin Name: %s\n", slv2_value_as_string(name));
	instance=slv2_plugin_instantiate(plugin,44000,NULL);
	if (!instance)
		die("unable to instantiate plugin.\n");

	

	printf("hello\n");
	return 0;
}


